var browserurl = window.document.location.pathname;
var context = browserurl.indexOf("/") != -1 ? browserurl.substring(0, browserurl.substr(1).indexOf('/') + 1) : "";
require.config({
    urlArgs: 'v=164409_9',//部署到生成环境之前移除它。
    baseUrl: context + "/resource/js",
    paths: {
        jquery: 'jquery-1.9.1.min',
        jqueryUI: 'lib/jquery-ui.min',
        bootstrap: "lib/bootstrap.min",
        index: "page/index",//首页
        register: "page/register",//注册
        forgetPassword: "page/forgetPassword",//忘记密码
        mattersCenter: "page/mattersCenter",//事项中心
        searchCenter: "page/searchCenter",//搜索页面
        userCenter: "page/userCenter",//个人中心
        queryCenter: "page/queryCenter",//查询中心
        consultCenter: "page/consultCenter",//咨询中心
        appCenter: "page/appCenter",//应用中心
        appCenterBillResource: "page/appCenterBillResource",//应用中心-表单下载
        appCenterReport: "page/appCenterReport",//应用中心-线索举报
        order: "page/order",//应用中心
        helpCenter: "page/helpCenter",//帮助中心
        policeAffairs: "page/policeAffairs",//警务公开
        appointmentCenter: "page/appointmentCenter",//预约中心
        slideNav: "app/slideNav",//顶部滑动导航
        searchNav: "app/searchNav",//顶部搜索按钮
        unslider: "app/unslider",//首页小轮播
        wow: "app/wow.min",//wow动画插件
        sidePanel: "app/sidePanel",//侧边功能区
        countUp: "app/countUp.min",//首页浏览人数统计
        multiRowScroll: "app/multiRowScroll",//首页通知多行滚动**不用了**
        easysroll: "app/easysroll",//多行滚动
        draggableExtend: "app/draggableExtend",//扩展JQUI的拖拽事件（移动端）
        darkTooltip: 'app/jquery.darktooltip',//注册提示
        registerCheck: 'app/registerCheck',//注册验证
        findStr: "app/findStr",//查询字符
        popup: "app/popup",//弹出层
        typed: "app/typed.min",//文字打字效果
        laydate: "app/laydate/laydate",//日期控件
        Jcrop: "app/jquery.Jcrop.min",//截图控件
        jqPaginator: "lib/jqPaginator",//翻页
        uiwidget: "jquery.ui.widget",
        fileupload: "jquery.fileupload",
        iframetransport: "jquery.iframetransport",//上传附件控件
        fileuploadprocess: "jquery.fileuploadprocess",
        fileuploadvalidate: "jquery.fileuploadvalidate",
        lazyload: "app/jquery.lazyload",//图片异步加载
        toastr: "toastr",
        layerjs: "layer/layer",
        jqueryvalidata: "app/jquery-validation/1.11.0/jquery.validate",
        jqueryselect: "jquery-select"
    },
    shim: {
        "bootstrap": {
            deps: ["jquery"]
        },
        "unslider": {
            deps: ["jquery"],
            exports: 'jQuery.fn.unslider'
        },
        "wow": {
            exports: 'WOW'
        },
        "countUp": {
            deps: ["jquery"]
        },
        "multiRowScroll": {
            deps: ["jquery"]
        },
        "easysroll": {
            deps: ["jquery"]
        },
        "draggableExtend": {
            deps: ["jquery"],
        },
        "darkTooltip": {
            deps: ['jquery'],
        },
        "typed": {
            deps: ['jquery'],
        },
        "laydate": {
            exports: 'laydate'
        },
        "Jcrop": {
            deps: ['jquery']
        },
        "jqPaginator": {
            deps: ['jquery']
        },
        "fileupload": {
            deps: ['jquery']
        },
        "lazyload": {
            deps: ['jquery']
        },
        "toastr": {
            deps: ['jquery']
        },
        "jqueryvalidata": {
            deps: ['jquery']
        },
        "jqueryselect": {
            deps: ['jquery']
        },
        "layerjs": {
            deps: ['jquery']
        }
    }
});

require(['jquery', 'bootstrap', 'slideNav', 'searchNav', 'wow', 'sidePanel', 'popup', 'jqPaginator', 'toastr', 'fileupload'],
    function ($, bootstrap, slideNav, searchNav, wow, sidePanel, popup, jqPaginator, toastr, fileupload) {
        //首页
        //头部公用导航
        slideNav.init();//滑动菜单
        searchNav.init();//搜索
        //wow
        var wow = new wow();
        wow.init();

        //侧边功能面板
         var sp = new sidePanel();
         sp.init({
         qqNumber:"10001",//在线QQ号码
         phoneNumber:"123456789",//联系电话
         ewmImg:context+"/resource/images/ewm.png",//二维码图片
         });

        //顶部登录
        $(".login-a").click(function () {
            var topLogin = new popup();
            //console.log(topLogin.constructor)
            topLogin.popup_alert({
                width: 440,
                height: 580,
                id: "login_popup",
                y: 0,
                hasMask: true,
                isDraggable: true,
                dragHandle: ".popup-h",//拖拽部位
                hasConfirmBtn: false,//不出现确定按钮
                hasCloseBtn: true,//是的出现右上角的关闭按钮，默认不出
                hasIframe: true,
                iframeSrc: context + '/members/login',
                iframeW: "410",
                iframeH: "512",
            });
        });

        //--判断不同页面执行不同模块
        var currentPage = $("#current-page").attr("current-page");
        if (currentPage === "index") { //***********首页**********
            console.log("这是首页")
            require(['index'], function (index) {
                index.init();
            })
        } else if (currentPage === "register") { //***********注册页**********
            console.log("这是注册页");
            require(['register'], function (register) {
                register.init();
            })
        } else if (currentPage === "forgetPassword") {//********忘记密码***********
            console.log("这是忘记密码页");
            require(['forgetPassword'], function (forgetPassword) {
                forgetPassword.init();
            })
        } else if (currentPage === "mattersCenter") {//********事项中心***********
            console.log("这是事项中心页");
            require(['mattersCenter'], function (mattersCenter) {
                mattersCenter.init();
            })
        } else if (currentPage === "searchCenter") {//********搜索中心***********
            console.log("这是搜索中心页");
            require(['searchCenter'], function (searchCenter) {
                searchCenter.init();
            })
        } else if (currentPage === "userCenter") {//********个人中心***********
            console.log("这是个人中心页");
            require(['userCenter'], function (userCenter) {
                userCenter.init();
            })
        } else if (currentPage === "queryCenter") {//********查询中心***********
            console.log("这是查询中心页");
            require(['queryCenter'], function (queryCenter) {
                queryCenter.init();
            })
        } else if (currentPage === "consultCenter") {//********咨询中心***********
            console.log("这是咨询中心页");
            require(['consultCenter'], function (consultCenter) {
                consultCenter.init();
            })
        } else if (currentPage === "helpCenter") {//********帮助中心***********
            console.log("这是帮助中心页");
            require(['helpCenter'], function (helpCenter) {
                helpCenter.init();
            })
        } else if (currentPage === "appCenter") {//********应用中心***********
            console.log("这是应用中心页");
            require(['appCenter'], function (appCenter) {
                appCenter.init();
            })
        } else if (currentPage === "appCenterBillResource") {//********应用中心-表单下载***********
            console.log("这是应用中心页-表单下载");
            require(['appCenterBillResource'], function (appCenterBillResource) {
                appCenterBillResource.init();
            })
        } else if (currentPage === "appCenterReport") {//********应用中心***********
            console.log("这是应用中心页线索举报");
            require(['appCenterReport'], function (appCenterReport) {
                appCenterReport.init();
            })
        } else if (currentPage === "order") {//********预约中心***********
            console.log("预约中心");
            require(['order'], function (order) {
                order.init();
            })
        } else if (currentPage === "policeAffairs") {//********警务公开***********
            console.log("这是警务公开页");
            require(['policeAffairs'], function (policeAffairs) {
                policeAffairs.init();
            })
        } else if (currentPage === "test") {
            console.log("这是test页")
        }
    })
//function closePopup(id){
//	$('#'+id).remove();
//}
//var path="http://172.17.150.136:8083/osc";